|
mruby 4.0.0
mruby is the lightweight implementation of the Ruby language
|
Typical build configuration files are located in build_config directory. For examples:
You can specify the build configuration file with the MRUBY_CONFIG environment variable (or CONFIG in short). If the value specified by MRUBY_CONFIG is not the path to the configuration file, build_config/${MRUBY_CONFIG}.rb is used. So you can specify it as rake MRUBY_CONFIG=boxing, for example.
When you write a new build configuration description, please contribute. We welcome your contribution as a GitHub pull-request.
We have ported some new syntax from CRuby.
Some configuration macro names are changed for consistency (use MRB_USE_XXX or MRB_NO_XXX).
| mruby2 | mruby3 |
|---|---|
| MRB_ENABLE_ALL_SYMBOLS | MRB_USE_ALL_SYMBOLS |
| MRB_ENABLE_CXX_ABI | MRB_USE_CXX_ABI |
| MRB_ENABLE_CXX_EXCEPTION | MRB_USE_CXX_EXCEPTION |
| MRB_ENABLE_DEBUG_HOOK | MRB_USE_DEBUG_HOOK |
| MRB_DISABLE_DIRECT_THREADING | MRB_NO_DIRECT_THREADING |
| MRB_DISABLE_STDIO | MRB_NO_STDIO |
| MRB_METHOD_T_STRUCT | MRB_USE_METHOD_T_STRUCT |
| MRB_USE_FLOAT | MRB_USE_FLOAT32 |
| MRB_WITHOUT_FLOAT | MRB_NO_FLOAT |
| ENABLE_LINENOISE | MRB_USE_LINENOISE |
| ENABLE_READLINE | MRB_USE_READLINE |
| DISABLE_MIRB_UNDERSCORE | MRB_NO_MIRB_UNDERSCORE |
Uses struct to represent mrb_value. Consumes more memory but easier to investigate the internal and to debug. It used to be default mrb_value representation. Now the default is MRB_WORD_BOXING.
Pack mrb_value in an intptr_t integer. Consumes less memory compared to MRB_NO_BOXING especially on 32-bit platforms. Fixnum size is 31 bits so some integer values does not fit in Fixnum integers.
Pack mrb_value in a floating-point number. Nothing changed from previous versions.
Call malloc_trim(0) from mrb_full_gc() if this macro is defined. If you are using glibc malloc, this macro could reduce memory consumption.
The mruby3 now automatically detects *.mrb files without the -b switch. Therefore, it can be mixed with the *.rb file in combination with the -r switch and specified at the same time. Here's an example that works fine:
mruby3 introduces a few new instructions.
Instructions that access pool[i]/syms[i] where i>255.
Instructions that load a 32-bit integer.
Instruction that unwinds jump table for rescue/ensure.
Renamed from OP_RAISE
Instruction that is reserved for the future keyword argument support.
Instructions for old exception handling
No more operand extension
Jump addresses used to be specified by absolute offset from the start of iseq. Now they are relative offset from the address of the next instruction.
For better and faster random number generation.
Preallocated symbols are interned at compile-time. They can be accessed via symbols macros (e.g. MRB_SYM()).
See Symbols.